﻿using System;
using Microsoft.Owin.Hosting;
using Sustainalytics.Common.Hosting;

namespace Sustainalytics.WebApiHosting
{
    public class WebApiServiceDefinition<T> : IServiceDefinition
    {
        string url;
        string name;
        public WebApiServiceDefinition(string url, string name)
        {
            this.url = url;
            this.name = name;
        }


        public IDisposable Start()
        {
            return WebApp.Start<T>(this.url);
        }


        public string GetShortDescription()
        {
            return string.Format("{0}@{1}", name, url );
        }
    }
}
